/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DesignerGUI.java
 *
 * Created on 14.05.2009, 14:26:13
 */

package peripheral.designer;

import peripheral.designer.wizard.addAnimationDialog;

/**
 *
 * @author Berni
 */
public class DesignerGUI extends javax.swing.JFrame {

    /** Creates new form DesignerGUI */
    public DesignerGUI() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ProcessChainTabPane = new javax.swing.JTabbedPane();
        SensorPanel = new javax.swing.JPanel();
        BackgroundPanel = new javax.swing.JPanel();
        jFileChooser1 = new javax.swing.JFileChooser();
        AnimationsPanel = new javax.swing.JPanel();
        DefAnimationsPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        defAnimationsList = new javax.swing.JList();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        animationPropertiesTable = new javax.swing.JTable();
        addAnimationButton = new javax.swing.JButton();
        removeAnimationButton = new javax.swing.JButton();
        editAnimationButton = new javax.swing.JButton();
        SavePanel = new javax.swing.JPanel();
        ApplicationMenu = new javax.swing.JMenuBar();
        FileMenu = new javax.swing.JMenu();
        exitMenu = new javax.swing.JMenuItem();
        EditMenu = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        org.jdesktop.layout.GroupLayout SensorPanelLayout = new org.jdesktop.layout.GroupLayout(SensorPanel);
        SensorPanel.setLayout(SensorPanelLayout);
        SensorPanelLayout.setHorizontalGroup(
            SensorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 652, Short.MAX_VALUE)
        );
        SensorPanelLayout.setVerticalGroup(
            SensorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 428, Short.MAX_VALUE)
        );

        ProcessChainTabPane.addTab("Sensorserver", SensorPanel);

        jFileChooser1.setControlButtonsAreShown(false);

        org.jdesktop.layout.GroupLayout BackgroundPanelLayout = new org.jdesktop.layout.GroupLayout(BackgroundPanel);
        BackgroundPanel.setLayout(BackgroundPanelLayout);
        BackgroundPanelLayout.setHorizontalGroup(
            BackgroundPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(BackgroundPanelLayout.createSequentialGroup()
                .add(50, 50, 50)
                .add(jFileChooser1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(52, Short.MAX_VALUE))
        );
        BackgroundPanelLayout.setVerticalGroup(
            BackgroundPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(BackgroundPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(jFileChooser1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        ProcessChainTabPane.addTab("Background", BackgroundPanel);

        DefAnimationsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Defined Animations"));

        defAnimationsList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(defAnimationsList);

        org.jdesktop.layout.GroupLayout DefAnimationsPanelLayout = new org.jdesktop.layout.GroupLayout(DefAnimationsPanel);
        DefAnimationsPanel.setLayout(DefAnimationsPanelLayout);
        DefAnimationsPanelLayout.setHorizontalGroup(
            DefAnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, DefAnimationsPanelLayout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 195, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        DefAnimationsPanelLayout.setVerticalGroup(
            DefAnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(DefAnimationsPanelLayout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 347, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(8, Short.MAX_VALUE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("AnimationProperties"));

        animationPropertiesTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Propertyname", "Propertyvalue"
            }
        ));
        jScrollPane2.setViewportView(animationPropertiesTable);

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(9, 9, 9)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 211, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE)
                .addContainerGap())
        );

        addAnimationButton.setText("+");
        addAnimationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addAnimationButtonActionPerformed(evt);
            }
        });

        removeAnimationButton.setText("-");

        editAnimationButton.setText("...");

        org.jdesktop.layout.GroupLayout AnimationsPanelLayout = new org.jdesktop.layout.GroupLayout(AnimationsPanel);
        AnimationsPanel.setLayout(AnimationsPanelLayout);
        AnimationsPanelLayout.setHorizontalGroup(
            AnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AnimationsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(DefAnimationsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(AnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(addAnimationButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(removeAnimationButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(editAnimationButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(50, 50, 50)
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        AnimationsPanelLayout.setVerticalGroup(
            AnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AnimationsPanelLayout.createSequentialGroup()
                .add(AnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(AnimationsPanelLayout.createSequentialGroup()
                        .add(36, 36, 36)
                        .add(addAnimationButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(removeAnimationButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(editAnimationButton))
                    .add(AnimationsPanelLayout.createSequentialGroup()
                        .add(28, 28, 28)
                        .add(AnimationsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(DefAnimationsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 383, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        ProcessChainTabPane.addTab("Animations", AnimationsPanel);

        org.jdesktop.layout.GroupLayout SavePanelLayout = new org.jdesktop.layout.GroupLayout(SavePanel);
        SavePanel.setLayout(SavePanelLayout);
        SavePanelLayout.setHorizontalGroup(
            SavePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 652, Short.MAX_VALUE)
        );
        SavePanelLayout.setVerticalGroup(
            SavePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 428, Short.MAX_VALUE)
        );

        ProcessChainTabPane.addTab("Save", SavePanel);

        FileMenu.setText("File");

        exitMenu.setText("Exit");
        exitMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuActionPerformed(evt);
            }
        });
        FileMenu.add(exitMenu);

        ApplicationMenu.add(FileMenu);

        EditMenu.setText("Edit");
        ApplicationMenu.add(EditMenu);

        setJMenuBar(ApplicationMenu);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(ProcessChainTabPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 673, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(ProcessChainTabPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 474, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addAnimationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addAnimationButtonActionPerformed

        addAnimationDialog aaD = new addAnimationDialog(this,true);
        aaD.setVisible(true);
    }//GEN-LAST:event_addAnimationButtonActionPerformed

    private void exitMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuActionPerformed

        this.setVisible(false);
        this.dispose();
        System.exit(0);
    }//GEN-LAST:event_exitMenuActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new DesignerGUI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel AnimationsPanel;
    private javax.swing.JMenuBar ApplicationMenu;
    private javax.swing.JPanel BackgroundPanel;
    private javax.swing.JPanel DefAnimationsPanel;
    private javax.swing.JMenu EditMenu;
    private javax.swing.JMenu FileMenu;
    private javax.swing.JTabbedPane ProcessChainTabPane;
    private javax.swing.JPanel SavePanel;
    private javax.swing.JPanel SensorPanel;
    private javax.swing.JButton addAnimationButton;
    private javax.swing.JTable animationPropertiesTable;
    private javax.swing.JList defAnimationsList;
    private javax.swing.JButton editAnimationButton;
    private javax.swing.JMenuItem exitMenu;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton removeAnimationButton;
    // End of variables declaration//GEN-END:variables

}
